using micromsg;
using MicroMsg.Common.Event;
using MicroMsg.Common.Utils;
using MicroMsg.Protocol;
using System;
namespace MicroMsg.Scene
{
	public class NetSceneExpose : NetSceneBaseEx<ExposeRequest, ExposeResponse, ExposeRequest.Builder>
	{
		private const string TAG = "NetSceneExpose";
		public bool doScene(string userName, ExposeScene scene, uint type = 0u)
		{
			base.beginBuilder();
			this.mBuilder.BaseRequest = NetSceneBase.makeBaseRequest(0);
			this.mBuilder.UserName = userName;
			this.mBuilder.Scene = (uint)scene;
			this.mBuilder.Type = type;
			this.mSessionPack.mCmdID = 59;
			base.endBuilder();
			return true;
		}
		protected override void onFailed(ExposeRequest request, ExposeResponse response)
		{
			Log.smethod_1("NetSceneExpose", "send ExposeRequest failed");
			EventCenter.postEvent(EventConst.ON_NETSCENE_EXPOSE_ERR, null, null);
		}
		protected override void onSuccess(ExposeRequest request, ExposeResponse response)
		{
			RetConst ret = (RetConst)response.BaseResponse.Ret;
			if (ret != RetConst.MM_OK)
			{
				Log.smethod_1("NetSceneExpose", "send ExposeRequest failed ret =" + ret);
				EventCenter.postEvent(EventConst.ON_NETSCENE_EXPOSE_ERR, null, null);
				return;
			}
			EventCenter.postEvent(EventConst.ON_NETSCENE_EXPOSE_SUCCESS, null, null);
		}
	}
}
